package num268;

import java.util.Arrays;
import java.util.HashMap;

/**
 * 268. 丢失的数字
 * 题目：https://leetcode-cn.com/problems/missing-number/
 * 三叶姐题解:  * 三叶姐题解: https://leetcode-cn.com/problems/ugly-number/solution/gong-shui-san-xie-jian-dan-de-fen-qing-k-dlvg/
 *
 * 系统排序
 */
class Solution {
    public int missingNumber(int[] nums) {
        int n = nums.length;
        Arrays.sort(nums);
        for (int i = 0; i < n; i++) {
            if (i != nums[i]) {
                return i;
            }
        }
        return n;
    }
}
